﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace QMERP.Infrastructure.EFCore.Migrations
{
    /// <inheritdoc />
    public partial class init36 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "RetailOrder_SalesProcess");

            migrationBuilder.RenameColumn(
                name: "PCenter",
                table: "RetailOrderDetail",
                newName: "CenterThickness");

            migrationBuilder.RenameColumn(
                name: "Hight",
                table: "RetailOrderDetail",
                newName: "PH");

            migrationBuilder.AddColumn<string>(
                name: "CaiBian",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "CheBian",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Coating",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Frame",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "Hard",
                table: "RetailOrder",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<string>(
                name: "KaiKeng",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Mirror",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "PaoGuang",
                table: "RetailOrder",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<string>(
                name: "PiHua",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "TintingCode",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "TintingColor",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "TintingName",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "UV",
                table: "RetailOrder",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<string>(
                name: "ZuanKong",
                table: "RetailOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "CaiBian",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "CheBian",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "Coating",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "Frame",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "Hard",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "KaiKeng",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "Mirror",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "PaoGuang",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "PiHua",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "TintingCode",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "TintingColor",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "TintingName",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "UV",
                table: "RetailOrder");

            migrationBuilder.DropColumn(
                name: "ZuanKong",
                table: "RetailOrder");

            migrationBuilder.RenameColumn(
                name: "PH",
                table: "RetailOrderDetail",
                newName: "Hight");

            migrationBuilder.RenameColumn(
                name: "CenterThickness",
                table: "RetailOrderDetail",
                newName: "PCenter");

            migrationBuilder.CreateTable(
                name: "RetailOrder_SalesProcess",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RetailOrderId = table.Column<long>(type: "bigint", nullable: false),
                    SalesProcessId = table.Column<long>(type: "bigint", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RetailOrder_SalesProcess", x => x.Id);
                    table.ForeignKey(
                        name: "FK_RetailOrder_SalesProcess_RetailOrder_RetailOrderId",
                        column: x => x.RetailOrderId,
                        principalTable: "RetailOrder",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_RetailOrder_SalesProcess_SalesProcess_SalesProcessId",
                        column: x => x.SalesProcessId,
                        principalTable: "SalesProcess",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_RetailOrder_SalesProcess_Id",
                table: "RetailOrder_SalesProcess",
                column: "Id");

            migrationBuilder.CreateIndex(
                name: "IX_RetailOrder_SalesProcess_RetailOrderId",
                table: "RetailOrder_SalesProcess",
                column: "RetailOrderId");

            migrationBuilder.CreateIndex(
                name: "IX_RetailOrder_SalesProcess_SalesProcessId",
                table: "RetailOrder_SalesProcess",
                column: "SalesProcessId");
        }
    }
}
